Skip to content

refactor: Remove trpc/react dependency from @calcom/atoms#91

Open
tomerqodo wants to merge 8 commits intogreptile_combined_20260121_qodo_grep_cursor_copilot_1_base_refactor_remove_trpc_react_dependency_from_calcom_atoms_pr722from
greptile_combined_20260121_qodo_grep_cursor_copilot_1_head_refactor_remove_trpc_react_dependency_from_calcom_atoms_pr722
Open

refactor: Remove trpc/react dependency from @calcom/atoms#91
tomerqodo wants to merge 8 commits intogreptile_combined_20260121_qodo_grep_cursor_copilot_1_base_refactor_remove_trpc_react_dependency_from_calcom_atoms_pr722from
greptile_combined_20260121_qodo_grep_cursor_copilot_1_head_refactor_remove_trpc_react_dependency_from_calcom_atoms_pr722

Conversation

@tomerqodo
Copy link

Benchmark PR from qodo-benchmark#722

@greptile-apps
Copy link

greptile-apps bot commented Jan 21, 2026

Greptile Summary

Refactors the @calcom/atoms package to remove its dependency on @calcom/trpc/react by extracting shared data processing logic and creating separate hooks for web and platform contexts.

  • Extracted useProcessTeamMembersData utility function to share logic between platform and web implementations
  • Created new useTeamMembersWithSegment hook in apps/web for web app to use tRPC
  • Renamed useTeamMembersWithSegment to useTeamMembersWithSegmentPlatform in atoms package for platform-specific HTTP API calls
  • Updated AvailabilitySettings to replace RouterOutputs type with direct repository return type
  • Added biome lint rule to prevent future imports of @calcom/trpc/react in atoms package
  • Removed trpc/react from atoms tsconfig.json references

Critical Issue: The platform hook still imports @calcom/trpc/react on line 13 of useTeamMembersWithSegmentPlatform.tsx, which violates the newly added lint rule.

Potential Issue: The change from filteredMembers to teamMembers in EditWeightsForAllTeamMembers.tsx removes search and member filtering functionality.

Confidence Score: 1/5

  • This PR has a critical issue that prevents it from achieving its stated goal
  • The PR aims to remove trpc/react dependency from atoms but line 13 of useTeamMembersWithSegmentPlatform.tsx still imports from @calcom/trpc/react, which violates the newly added lint rule. Additionally, the change from filteredMembers to teamMembers removes filtering functionality without apparent justification.
  • Pay close attention to packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx which still has the prohibited import

Important Files Changed

Filename Overview
packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx Extracted shared logic and renamed file, but still imports from @calcom/trpc/react which violates the new lint rule
apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx New hook created for web app to use trpc, reuses shared logic from atoms package
apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx Updated imports and changed rendering to use teamMembers instead of filteredMembers, removing filtering logic

Sequence Diagram

sequenceDiagram
    participant Web as Web App
    participant WebHook as useTeamMembersWithSegment (Web)
    participant TRPC as tRPC Client
    participant Platform as Platform Atoms
    participant PlatformHook as useTeamMembersWithSegmentPlatform
    participant HTTP as HTTP Client
    participant SharedLogic as useProcessTeamMembersData

    Note over Web,SharedLogic: Platform Context (isPlatform=true)
    Web->>PlatformHook: useTeamMembersWithSegmentPlatform()
    PlatformHook->>HTTP: GET /atoms/organizations/{orgId}/teams/{teamId}/members-matching-attribute
    HTTP-->>PlatformHook: matchingTeamMembersWithResult
    PlatformHook->>SharedLogic: useProcessTeamMembersData()
    SharedLogic-->>PlatformHook: { teamMembers, localWeightsInitialValues, isPending }
    PlatformHook-->>Web: Return processed data

    Note over Web,SharedLogic: Web Context (isPlatform=false)
    Web->>WebHook: useTeamMembersWithSegment()
    WebHook->>TRPC: trpc.viewer.attributes.findTeamMembersMatchingAttributeLogic.useQuery()
    TRPC-->>WebHook: matchingTeamMembersWithResult
    WebHook->>SharedLogic: useProcessTeamMembersData()
    SharedLogic-->>WebHook: { teamMembers, localWeightsInitialValues, isPending }
    WebHook-->>Web: Return processed data
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (2)

  1. packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx, line 13 (link)

    logic: violates the new biome lint rule that prohibits importing @calcom/trpc/react in the atoms package

  2. apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx, line 231-249 (link)

    style: filteredMembers is computed but never used since the code now uses teamMembers directly

7 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

const { teamMembers, localWeightsInitialValues } = useProcessTeamMembersData({
initialTeamMembers,
assignRRMembersUsingSegment,
matchingTeamMembersWithResult: matchingTeamMembersWithResult?.result ? { result: matchingTeamMembersWithResult.result } : matchingTeamMembersWithResult,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: verify the structure of matchingTeamMembersWithResult - the conditional wrapping suggests the trpc query might already return the result field directly, making the wrap redundant. does the trpc query return the result directly or wrapped in a result field?

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx
Line: 28:28

Comment:
**style:** verify the structure of `matchingTeamMembersWithResult` - the conditional wrapping suggests the trpc query might already return the result field directly, making the wrap redundant. does the trpc query return the result directly or wrapped in a result field?

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants